# -*- coding: utf-8 -*-

import os
import sys
from flask_script import Manager, Command
from flask_migrate import Migrate, MigrateCommand
from flask_script.commands import  Server

from hzb import create_app
from hzb.config import ProductConfig
from hzb.database import db



app = create_app(db, new_config=ProductConfig)
manager = Manager(app)
migrate = Migrate(app, db)


class CreateDB(Command):
    def run(self):
        db.create_all()


		
# manager.add_command('runserver', Server())
# manager.add_command('shell', Shell(make_context=_make_context))
manager.add_command('create_all_db', CreateDB())
manager.add_command('db', MigrateCommand)



if __name__ == "__main__":
# 局域网发布,命令行运行——python manager.py runserver --host 0.0.0.0
    manager.run()
    pass